Skip to content

feat(pass-extension): add autofill keyboard shortcut command#481

Open
yuribodo wants to merge 7 commits into
ProtonMail:mainfrom
yuribodo:feat/autofill-keyboard-shortcut
Open

feat(pass-extension): add autofill keyboard shortcut command#481
yuribodo wants to merge 7 commits into
ProtonMail:mainfrom
yuribodo:feat/autofill-keyboard-shortcut

Conversation

@yuribodo
Copy link
Copy Markdown

@yuribodo yuribodo commented Mar 29, 2026

Summary

Adds a keyboard shortcut to trigger autofill in the Proton Pass browser extension, as discussed and approved in #453.

  • Registers a new autofill command in Chrome and Firefox manifests with Ctrl+Shift+U as the default shortcut
  • Handles the command in the background script by sending an AUTOFILL_TRIGGER message to the active tab's content script
  • Content script finds the first detected login field and opens the autofill dropdown, reusing the existing inline dropdown flow

Closes #453

Changes

File Change
manifest-chrome.json Added "autofill" command entry
manifest-firefox.json Added "autofill" command entry
src/types/messages.ts Added AUTOFILL_TRIGGER to WorkerMessageType enum
src/lib/extension/commands.ts Added async handler for the "autofill" command
src/lib/extension/commands.spec.ts Added 4 unit tests for command handling
src/app/content/services/autofill/autofill.service.ts Registered AUTOFILL_TRIGGER handler using withContext pattern

How it works

  1. User presses Ctrl+Shift+U
  2. browser.commands.onCommand fires in the background script
  3. Background queries the active tab and sends AUTOFILL_TRIGGER via browser.tabs.sendMessage
  4. Content script's FrameMessageBroker receives the message
  5. Handler finds the first field with DropdownAction.AUTOFILL_LOGIN via formManager.getFields()
  6. Opens the autofill dropdown on that field using inline.dropdown.toggle()
  7. User selects credentials → normal autofill flow proceeds

If no login field is detected on the page, the shortcut is a no-op.

Design decisions

Default shortcut Ctrl+Shift+U: Chosen to avoid conflicts with existing commands (Ctrl+Shift+X for popup, Ctrl+Shift+L for larger window). The industry standard for autofill is Ctrl+Shift+L (used by Bitwarden and LastPass). If the team is open to it, reassigning Ctrl+Shift+L from open-larger-window to autofill in a follow-up would align with user expectations from competing password managers.

Dropdown approach (not direct autofill): Opens the dropdown instead of auto-filling the top match. This is safer, gives the user control when multiple credentials match, and reuses the existing dropdown infrastructure with minimal new code.

Safari excluded: Safari does not support the browser.commands API. The command listener is already gated by BUILD_TARGET !== 'safari' in worker/index.ts.

Test plan

  • Unit tests for handleExtensionCommand (4 tests passing):
    • Opens larger window for open-larger-window command
    • Sends AUTOFILL_TRIGGER to active tab for autofill command
    • Does not send message when no active tab is found
    • Does nothing for unknown commands
  • Manual: press Ctrl+Shift+U on a login page → dropdown opens on first login field
  • Manual: press Ctrl+Shift+U on a page with no login form → nothing happens
  • Manual: verify Ctrl+Shift+X and Ctrl+Shift+L still work as before
  • Manual: verify new shortcut appears in Settings → Shortcuts

@nguyenkims
Copy link
Copy Markdown
Collaborator

Hi thanks for the MR, from what I understand, it simply opens the dropdown? Currently it already opens when the username/password field is in focus, which is the default behavior for most websites.

@yuribodo
Copy link
Copy Markdown
Author

Hi thanks for the MR, from what I understand, it simply opens the dropdown? Currently it already opens when the username/password field is in focus, which is the default behavior for most websites.

Hi @nguyenkims , that's correct it opens the dropdown rather than firing autofill directly

The difference from the default focus behavior is that this works keyboard-only, without the user having to click or tab into a field first. That's the main use case: power users who want to fill credentials without touching the mouse at all.

The feature request in #453 has quite a bit of community interest, which is what motivated this contribution. Happy to discuss scope or adjust the approach if you have a different direction in mind!

@nguyenkims
Copy link
Copy Markdown
Collaborator

Thanks, but once the dropdown is shown, users still need to use the mouse to select a login. For a keyboard-centric experience, it'd be nice to let users navigate with the up/down arrow keys.

@mmso mmso force-pushed the main branch 4 times, most recently from 115579e to b6fd253 Compare June 3, 2026 16:16
yuribodo added 2 commits June 3, 2026 23:38
The Ctrl+Shift+U shortcut opens the dropdown with autofocused:false, so neither the page field nor the iframe receives keyboard focus. Expose requestFocus() on the dropdown that reuses the existing focus-lock bypass, and call it once the dropdown is visible so the suggestions can be reached from the keyboard.
…keys

Wire useDropdownArrowNavigation + useHotkeys (bound to the iframe document) in the login view so the suggestions can be moved through with the arrow keys, selected with Enter, and dismissed with Escape. Highlight the focused item in the injected dropdown styles.
@yuribodo yuribodo force-pushed the feat/autofill-keyboard-shortcut branch from b9a9fb0 to d639fe2 Compare June 4, 2026 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proton Pass Web Extension - Autofill keyboard shortcut contribution

2 participants